<template>
  <view class="container">
    <u--form
        labelPosition="left"
        :model="baseInfo"
        :rules="rules"
        ref="uForm"
        labelWidth="100"
        :labelStyle="{'align-self': 'start', 'font-size': '14px'}"
    >
      <module-card title="电站基本信息">
        <view class="base-info" :class="show ? 'show' : ''">
          <u-form-item label="产品编码" borderBottom>{{ baseInfo.projectCode }}</u-form-item>
          <u-form-item label="产品名称" borderBottom>{{ baseInfo.projectName }}</u-form-item>
          <u-form-item label="代理商名称"borderBottom >{{ trader.name }}</u-form-item>
          <u-form-item label="经销商电话" borderBottom>{{ trader.mobile }}</u-form-item>
          <u-form-item label="户主姓名" borderBottom>{{ baseInfo.tenantName }}</u-form-item>
          <u-form-item label="身份证号码" borderBottom>{{ baseInfo.idCode }}</u-form-item>
          <u-form-item label="安装地址" borderBottom>{{ baseInfo.province + baseInfo.city + baseInfo.area + baseInfo.address }}</u-form-item>
          <u-form-item label="联系电话" borderBottom>{{ baseInfo.mobile }}</u-form-item>
          <u-form-item label="安装方案" borderBottom>{{ PLAN_TYPE_VALUE_TO_LABEL[baseInfo.schemeType] }}</u-form-item>
          <u-form-item label="电站编码" borderBottom>{{ baseInfo.powerStationCode }}</u-form-item>
          <u-form-item label="组件规格" borderBottom>{{ baseInfo.componentSpec }}</u-form-item>
          <u-form-item label="安装组件数量" borderBottom>{{formData.componentNum}}</u-form-item>
          <u-form-item label="通讯棒SN码" borderBottom>
            <u-input
                v-model="formData.snOne"
                placeholder="请输入通讯棒SN码"
                clearable></u-input>
          </u-form-item>
          <u-form-item label="通讯棒SN码" borderBottom>
            <u-input
                v-model="formData.snTwo"
                placeholder="请输入通讯棒SN码"
                clearable></u-input>
          </u-form-item>
          <u-form-item label="逆变器SN码" borderBottom>
            <u-input
                v-model="formData.nbqSnOne"
                placeholder="请输入逆变器SN码"
                clearable></u-input>
          </u-form-item>
          <u-form-item label="逆变器SN码" borderBottom>
            <u-input
                v-model="formData.nbqSnTwo"
                placeholder="请输入逆变器SN码"
                clearable></u-input>
          </u-form-item>

          <!--<u-form-item-->
          <!--    label="朝向角度"-->
          <!--    prop="baseInfo.azimuth"-->
          <!--    borderBottom-->
          <!--&gt;-->
          <!--  {{ baseInfo.azimuth }} {{ baseInfo.azimuth !== AZIMUTH.SOUTH ? baseInfo.angle + '°' : '' }}-->
          <!--</u-form-item>-->
          <!--<view class="mask"></view>-->
        </view>
        <!--居中的收起按钮-->
        <!--<view class="toggle">-->
        <!--  <u&#45;&#45;text-->
        <!--      :prefixIcon="show ? 'arrow-up' : 'arrow-down'"-->
        <!--      @click="show = !show"-->
        <!--      iconStyle="font-size: 12px;color:#fff;margin-right: 5px;"-->
        <!--      color="#fff"-->
        <!--      :text="show ? '收起' : '展开'"-->
        <!--  ></u&#45;&#45;text>-->
        <!--</view>-->

        <!--<u-form-item-->
        <!--    label="安装组件规格"-->
        <!--    prop="baseInfo.componentSpec"-->
        <!--    borderBottom-->

        <!--&gt;-->
        <!--  {{ baseInfo.componentSpec }}-->
        <!--</u-form-item>-->
        <!--<u-form-item-->
        <!--    label="安装组件块数"-->
        <!--    prop="baseInfo.field"-->
        <!--    borderBottom-->

        <!--&gt;-->
        <!--  5-->
        <!--</u-form-item>-->
        <!--<u-form-item-->
        <!--    label="实际安装容量"-->
        <!--    prop="baseInfo.actualCapacity"-->
        <!--    borderBottom-->

        <!--&gt;-->
        <!--  {{ baseInfo.actualCapacity }} W-->
        <!--</u-form-item>-->
      </module-card>

      <module-card title="电站安装完成验收条款项">
        <view class="form-item-title">1.设备信息照片</view>
        <u-row justify="space-between" gutter="10" class="border-bottom">
          <u-col span="4">
            <u-form-item :label="null" prop="details.zjPlateImg">
              <view>
                <image-upload v-model="formData.zjPlateImg"/>
                <view class="form-item-subtitle"><text class="required">*</text>组件铭牌</view>
              </view>
            </u-form-item>
          </u-col>
          <u-col span="4">
            <u-form-item :label="null" prop="details.nbqPlateImg">
              <view>
                <image-upload v-model="formData.nbqPlateImg"/>
                <view class="form-item-subtitle"><text class="required">*</text>逆变器1铭牌</view>
              </view>
            </u-form-item>
          </u-col>
          <u-col span="4">
            <u-form-item :label="null" prop="details.nbqPlateTwoImg">
              <view>
                <image-upload v-model="formData.nbqPlateTwoImg"/>
                <view class="form-item-subtitle"><text class="required">*</text>逆变器2铭牌</view>
              </view>
            </u-form-item>
          </u-col>
        </u-row>
        <u-row
            justify="space-between"
            gutter="10"
            class="border-bottom"
        >
          <u-col span="4">
            <u-form-item
                :label="null"
                prop="details.txPlateImg"
            >
              <view>
                <image-upload v-model="formData.txPlateImg"/>
                <view class="form-item-subtitle"><text class="required">*</text>通讯棒1铭牌</view>
              </view>
            </u-form-item>
          </u-col>
          <u-col span="4">
            <u-form-item
                :label="null"
                prop="details.txPlateTwoImg"
            >
              <view>
                <image-upload v-model="formData.txPlateTwoImg"/>
                <view class="form-item-subtitle"><text class="required">*</text>通讯棒2铭牌</view>
              </view>
            </u-form-item>
          </u-col>
          <u-col span="4"></u-col>
        </u-row>


        <view class="form-item-title">2.支架及组件安装照片</view>
        <u-row justify="space-between" gutter="10">
          <u-col span="4">
            <u-form-item :label="null" prop="details.zjImg1">
              <view>
                <image-upload v-model="formData.zjImg1"/>
                <view class="form-item-subtitle"><text class="required">*</text>支架安装图片1</view>
              </view>
            </u-form-item>
          </u-col>
          <u-col span="4">
            <u-form-item :label="null" prop="details.zjImg2">
              <view>
                <image-upload v-model="formData.zjImg2"/>
                <view class="form-item-subtitle"><text class="required">*</text>支架安装图片2</view>
              </view>
            </u-form-item>
          </u-col>
          <u-col span="4">
            <u-form-item :label="null" prop="details.zjImg3">
              <view>
                <image-upload v-model="formData.zjImg3"/>
                <view class="form-item-subtitle"><text class="required">*</text>支架安装图片3</view>
              </view>
            </u-form-item>
          </u-col>
        </u-row>
        <u-row
            justify="space-between"
            gutter="10"
        >
          <u-col span="4">
            <u-form-item
                :label="null"
                prop="details.zjImg4"
            >
              <view>
                <image-upload v-model="formData.zjImg4"/>
                <view class="form-item-subtitle"><text class="required">*</text>支架安装图片4</view>
              </view>
            </u-form-item>
          </u-col>
          <u-col span="4">
            <u-form-item
                :label="null"
                prop="details.zjImg5"
            >
              <view>
                <image-upload v-model="formData.zjImg5"/>
                <view class="form-item-subtitle"><text class="required">*</text>支架安装图片5</view>
              </view>
            </u-form-item>
          </u-col>
          <u-col span="4">
            <u-form-item
                :label="null"
                prop="details.componentImg1"
            >
              <view>
                <image-upload v-model="formData.componentImg1"/>
                <view class="form-item-subtitle"><text class="required">*</text>组件安装图片</view>
              </view>
            </u-form-item>
          </u-col>
        </u-row>
        <u-row
            justify="space-between"
            gutter="10"
            class="border-bottom"
        >
          <u-col span="4">
            <u-form-item
                :label="null"
                prop="details.field"
            >
              <view>
                <image-upload v-model="formData.componentImg2"/>
                <view class="form-item-subtitle"><text class="required">*</text>补充图片1</view>
              </view>
            </u-form-item>
          </u-col>
          <u-col span="4">
            <u-form-item
                :label="null"
                prop="details.componentImg3"
            >
              <view>
                <image-upload v-model="formData.componentImg3"/>
                <view class="form-item-subtitle"><text class="required">*</text>补充图片2</view>
              </view>
            </u-form-item>
          </u-col>
          <u-col span="4">
            <u-form-item
                :label="null"
                prop="details.componentImg4"
            >
              <view>
                <image-upload v-model="formData.componentImg4"/>
                <view class="form-item-subtitle"><text class="required">*</text>补充3图片</view>
              </view>
            </u-form-item>
          </u-col>
        </u-row>

        <view class="form-item-title">3.电器设备安装照片</view>
        <u-row justify="space-between" gutter="10">
          <u-col span="4">
            <u-form-item :label="null" prop="details.totalImgs">
              <view>
                <image-upload v-model="formData.totalImgs"/>
                <view class="form-item-subtitle"><text class="required">*</text>逆变器、并网箱、整体安装</view>
              </view>
            </u-form-item>
          </u-col>
          <u-col span="4">
            <u-form-item :label="null" prop="details.dcImgs">
              <view>
                <image-upload v-model="formData.dcImgs"/>
                <view class="form-item-subtitle"><text class="required">*</text>逆变器底部接线</view>
              </view>
            </u-form-item>
          </u-col>
          <u-col span="4">
            <u-form-item :label="null" prop="details.bwInnerImg">
              <view>
                <image-upload v-model="formData.bwInnerImg"/>
                <view class="form-item-subtitle"><text class="required">*</text>并网箱打开内部接线</view>
              </view>
            </u-form-item>
          </u-col>
        </u-row>
        <u-row
            justify="space-between"
            gutter="10"
        >
          <u-col span="4">
            <u-form-item
                :label="null"
                prop="details.field"
            >
              <view>
                <image-upload v-model="formData.cableTowardsImg"/>
                <view class="form-item-subtitle"><text class="required">*</text>电缆走向</view>
              </view>
            </u-form-item>
          </u-col>
          <u-col span="4">
            <u-form-item
                :label="null"
                prop="details.underwallCableImg"
            >
              <view>
                <image-upload v-model="formData.underwallCableImg"/>
                <view class="form-item-subtitle"><text class="required">*</text>下墙线缆</view>
              </view>
            </u-form-item>
          </u-col>
          <u-col span="4">
            <u-form-item
                :label="null"
                prop="details.dqsbAnImgOne"
            >
              <view>
                <image-upload v-model="formData.nbqZbImg"/>
                <view class="form-item-subtitle"><text class="required">*</text>补充1</view>
              </view>
            </u-form-item>
          </u-col>
        </u-row>
        <u-row
            justify="space-between"
            gutter="10"
            class="border-bottom"
        >
          <u-col span="4">
            <u-form-item
                :label="null"
                prop="details.dqsbAnImgTwo"
            >
              <view>
                <image-upload v-model="formData.dqsbAnimgOne"/>
                <view class="form-item-subtitle"><text class="required">*</text>补充图片2(不确定字段)</view>
              </view>
            </u-form-item>
          </u-col>
          <u-col span="4">
            <u-form-item
                :label="null"
                prop="details.field"
            >
              <view>
                <image-upload v-model="formData.dqsbAnimgTwo"/>
                <view class="form-item-subtitle"><text class="required">*</text>补充3图片</view>
              </view>
            </u-form-item>
          </u-col>
          <u-col span="4"></u-col>
        </u-row>

        <view class="form-item-title">4.接地系统照片</view>
        <u-row justify="space-between" gutter="10">
          <u-col span="4">
            <u-form-item :label="null" prop="details.zujianJdImg">
              <view>
                <image-upload v-model="formData.zujianJdImg"/>
                <view class="form-item-subtitle"><text class="required">*</text>组件接地</view>
              </view>
            </u-form-item>
          </u-col>
          <u-col span="4">
            <u-form-item :label="null" prop="details.zjJdImg">
              <view>
                <image-upload v-model="formData.zjJdImg"/>
                <view class="form-item-subtitle"><text class="required">*</text>支架接地</view>
              </view>
            </u-form-item>
          </u-col>
          <u-col span="4">
            <u-form-item :label="null" prop="details.jdjImg">
              <view>
                <image-upload v-model="formData.jdjImg"/>
                <view class="form-item-subtitle"><text class="required">*</text>支架接地极1</view>
              </view>
            </u-form-item>
          </u-col>
        </u-row>
        <u-row
            justify="space-between"
            gutter="10"
        >
          <u-col span="4">
            <u-form-item
                :label="null"
                prop="details.nbqBwxJdImg"
            >
              <view>
                <image-upload v-model="formData.nbqBwxJdImg"/>
                <view class="form-item-subtitle"><text class="required">*</text>逆变器和并网箱接地</view>
              </view>
            </u-form-item>
          </u-col>
          <u-col span="4">
            <u-form-item
                :label="null"
                prop="details.jdOtherImg"
            >
              <view>
                <image-upload v-model="formData.jdOtherImg"/>
                <view class="form-item-subtitle"><text class="required">*</text>逆变器和并网箱接地极</view>
              </view>
            </u-form-item>
          </u-col>
          <u-col span="4"></u-col>
        </u-row>

        <view class="form-item-title">5.调试记录照片</view>
        <u-row justify="space-between" gutter="10">
          <u-col span="4">
            <u-form-item :label="null" prop="details.zcKlImg1">
              <view>
                <image-upload v-model="formData.zcKlImg1"/>
                <view class="form-item-subtitle"><text class="required">*</text>组串1开路电压1测试</view>
              </view>
            </u-form-item>
          </u-col>
          <u-col span="4">
            <u-form-item :label="null" prop="details.zcKlImg2">
              <view>
                <image-upload v-model="formData.zcKlImg2"/>
                <view class="form-item-subtitle"><text class="required">*</text>组串2开路电压2测试</view>
              </view>
            </u-form-item>
          </u-col>
          <u-col span="4">
            <u-form-item :label="null" prop="details.zcKlImg3">
              <view>
                <image-upload v-model="formData.zcKlImg3"/>
                <view class="form-item-subtitle"><text class="required">*</text>组串3开路电压3测试</view>
              </view>
            </u-form-item>
          </u-col>
        </u-row>
        <u-row
            justify="space-between"
            gutter="10"
        >
          <u-col span="4">
            <u-form-item
                :label="null"
                prop="details.jdDzImg1"
            >
              <view>
                <image-upload v-model="formData.jdDzImg1"/>
                <view class="form-item-subtitle"><text class="required">*</text>支架接地电阻测试1</view>
              </view>
            </u-form-item>
          </u-col>
          <u-col span="4">
            <u-form-item
                :label="null"
                prop="details.txPlateTwoImg"
            >
              <view>
                <image-upload v-model="formData.jdDlImg2"/>
                <view class="form-item-subtitle"><text class="required">*</text>电气接地电路测试2</view>
              </view>
            </u-form-item>
          </u-col>
          <u-col span="4"></u-col>
        </u-row>

        <view class="form-item-title">6.方阵安装完毕整体照片</view>
        <u-row justify="space-between" gutter="10">
          <u-col span="4">
            <u-form-item :label="null" prop="details.gfFzImg">
              <view>
                <image-upload v-model="formData.gfFzImg"/>
                <view class="form-item-subtitle"><text class="required">*</text>光伏方阵整体<view>（清晰数出组件数量）</view></view>
              </view>
            </u-form-item>
          </u-col>
          <u-col span="4">
            <u-form-item :label="null" prop="details.nbqZbImg">
              <view>
                <image-upload v-model="formData.FinishOtherImg"/>
                <view class="form-item-subtitle"><text class="required">*</text>补充</view>
              </view>
            </u-form-item>
          </u-col>
          <u-col span="4"></u-col>
        </u-row>
      </module-card>
    </u--form>
  </view>
</template>

<script>
import ModuleCard from "../../../../../../components/business/module-card/index.vue";
import UForm from "../../../../../../uni_modules/uview-ui/components/u-form/u-form.vue";
import { getCustomerEntryDetail } from "../../../../../../api/customer";
import {AZIMUTH, PLAN_TYPE_VALUE_TO_LABEL} from "../../../../../../constant";
import {getProjectCompanyByIdApi} from "../../../../../../api/common/trader";
import FixedFooter from "../../../../../../components/business/fixed-footer/index.vue";
import UFormItem from "../../../../../../uni_modules/uview-ui/components/u-form-item/u-form-item.vue";
import UTextarea from "../../../../../../uni_modules/uview-ui/components/u-textarea/u-textarea.vue";
import imageUpload from "../../../../../../components/base/image-upload/index.vue";
import UInput from '../../../../../../uni_modules/uview-ui/components/u--input/u--input.vue';

export default {
  name: "index",
  components: {UInput, imageUpload, UForm, UFormItem, UTextarea, FixedFooter, ModuleCard},
  props: {
    stationId: {
      type: String,
      default: ""
    },
    baseInfo: {
      type: Object,
      default: () => {
        return {}
      }
    },
    trader: {
      type: Object,
      default: () => {
        return {}
      }
    },
    formData: {
      type: Object,
      default: () => {
        return {}
      }
    },
  },
  data() {
    return {
      show: true,
      // formData: {
      //   zjPlateImg: '',
      //   nbqPlateImg: '',
      //   nbqPlateTwoImg: '',
      //   txPlateImg: '',
      //   txPlateTwoImg: '',
      //
      //   zujianJdImg: '',
      //   zjJdImg: '',
      //   jdjImg: '',
      //   nbqBwxJdImg: '',
      //   jdOtherImg: '',
      //
      //   zcKlImg1: '',
      //   zcKlImg2: '',
      //   zcKlImg3: '',
      //
      //   jdDzImg1: '',
      //   gfFzImg: '',
      //   nbqZbImg: '',
      // },
      // details: {},
      // trader: {},
      id: '',
      rules:  {}
    }
  },
  computed: {
    PLAN_TYPE_VALUE_TO_LABEL() {
      return PLAN_TYPE_VALUE_TO_LABEL
    },
    AZIMUTH() {
      return AZIMUTH
    }
  },
  mounted() {
    // this.init()
  },
  methods: {
    // async init() {
    //   await this.getDetail()
    //   await this.getProjectCompanyById()
    // },
    // // 获取详情
    // async getDetail() {
    //   const { data } = await getCustomerEntryDetail(this.$props.stationId);
    //   this.details = data;
    // },
    // // 根据ID查询代理商信息
    // async getProjectCompanyById() {
    //   const { data } = await getProjectCompanyByIdApi(this.details?.distributorId);
    //   this.trader = data;
    // },
  }
}
</script>

<style lang="scss" scoped>
.upload-wrap{
  margin: 15px 0 0;
}
.container{
  padding-bottom: 70px;
}
.form-item-title{
  margin-top: 15px;
  margin-bottom: 10px;
}
.form-item-subtitle{
  font-size: 12px;
  color: #666;
  margin-top: 0px;
  .required{
    color: #ff0000;
    margin-right: 2px;
  }
}
.border-bottom{
  border-bottom: 1px solid #e8e8e8;
}
.mb-10{
  margin-bottom: 10px;
}
.no-margin{
  margin-top: 0px !important;
}
.footer-btn{
  margin: 0 0px;
  width: 100%;
}
.base-info{
  position: relative;
  height: 80px;
  overflow: hidden;
  *{
    transition: all 1s ease-in-out;
  }
  //由下向上白色渐变透明蒙层
  &.show{
    //min-height: 473px;
    height: auto;
    .mask{
      display: none;
    }
  }
  .mask{
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 80px;
    background: linear-gradient(to top, rgba(255,255,255,1), rgba(255,255,255,0));
  }
}
.toggle{
  display: inline-block;
  margin: 20px 0;
  background: #f9a512;
  text-align: center;
  padding: 5px 15px;
  color: #fff;
  border-radius: 15px;
  position: relative;
  left: 50%;
  transform: translateX(-50%);
}
</style>
